var e = require;
var t = module;
var o = exports;
var n,
    i =
        (this && this.__extends) ||
        ((n = function (e, t) {
            return (n =
                Object.setPrototypeOf ||
                ({__proto__: []} instanceof Array &&
                    function (e, t) {
                        e.__proto__ = t;
                    }) ||
                function (e, t) {
                    for (var o in t) Object.prototype.hasOwnProperty.call(t, o) && (e[o] = t[o]);
                })(e, t);
        }),
        function (e, t) {
            n(e, t);
            function o() {
                this.constructor = e;
            }
            e.prototype = null === t ? Object.create(t) : ((o.prototype = t.prototype), new o());
        }),
    r =
        (this && this.__decorate) ||
        function (e, t, o, n) {
            var i,
                r = arguments.length,
                a = r < 3 ? t : null === n ? (n = Object.getOwnPropertyDescriptor(t, o)) : n;
            if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) a = Reflect.decorate(e, t, o, n);
            else
                for (var c = e.length - 1; c >= 0; c--)
                    (i = e[c]) && (a = (r < 3 ? i(a) : r > 3 ? i(t, o, a) : i(t, o)) || a);
            return r > 3 && a && Object.defineProperty(t, o, a), a;
        };
Object.defineProperty(o, "__esModule", {value: !0});
var a = e("UIManager"),
    c = e("UIAniPlay"),
    u = e("UIDefine"),
    s = cc._decorator,
    p = s.ccclass,
    d = s.property;
s.menu;
e("Thor");
var l = (function (e) {
    i(t, e);
    function t() {
        var t = (null !== e && e.apply(this, arguments)) || this;
        t.rightawayShow = !1;
        t.rightawayClose = !1;
        t.openAudio = !0;
        t.autoWeigthSize = !1;
        t.uiId = 0;
        t.isViewInteraction = !0;
        return t;
    }
    Object.defineProperty(t.prototype, "createUIBaseComp", {
        get: function () {
            return !1;
        },
        set: function () {},
        enumerable: !1,
        configurable: !0
    });
    Object.defineProperty(t.prototype, "createTouchSwallow", {
        get: function () {
            return !1;
        },
        set: function () {},
        enumerable: !1,
        configurable: !0
    });
    t.prototype.onDestroy = function () {
        a.default.onDestroyVerifyStack(this);
        EventCenter.offTarget(this);
    };
    t.prototype.createdInit = function () {
        this.initOriginPos();
        this.autoWeigthSize && this.adaptScreen();
    };
    t.prototype.onOpen = function () {};
    t.prototype.showUI = function (e, t) {
        void 0 !== e && this._setUiData(e);
        this.node.active = !0;
        this.onOpen(e);
        this._touchSwallow && this._touchSwallow.setScale(4, 4);
        this._showEffect(t);
    };
    t.prototype.hideUI = function (e) {
        void 0 === e && (e = !1);
        0 == e && a.default.hideUIInStack(this);
        var t = this._getUIAniPlay();
        (t && t.hide()) || (this.node.active = !1);
    };
    t.prototype.redisplayUI = function (e) {
        void 0 === e && (e = !1);
        0 == e && a.default.redisplayUIInStack(this);
        var t = this._getUIAniPlay();
        (t && t.redisplay()) || (this.node.active = !0);
    };
    t.prototype.setInteraction = function (e) {
        this.isViewInteraction = e;
    };
    t.prototype.closeUI = function () {
        a.default.close(this);
    };
    t.prototype._setUiData = function (e) {
        void 0 === e && (e = {});
        this.ui_data = e;
    };
    t.prototype._isShow = function () {
        return !0;
    };
    t.prototype._getUIAniPlay = function () {
        return this.getComponent(c.default);
    };
    t.prototype._showUIAudio = function () {};
    t.prototype._showEffect = function (e) {
        var t = this;
        this.onShowStart();
        this.openAudio && this._showUIAudio();
        if (!this.rightawayShow) {
            var o = this._getUIAniPlay();
            if (
                o &&
                o.show(function () {
                    e && e();
                    t.onShowEnd();
                })
            )
                return;
        }
        e && e();
        this.onShowEnd();
    };
    t.prototype._closeEffect = function (e) {
        var t = this;
        this.onCloseStart();
        if (!this.rightawayClose) {
            var o = this._getUIAniPlay();
            if (
                o &&
                o.close(function () {
                    e && e();
                    t.onCloseEnd();
                })
            )
                return;
        }
        e && e();
        this.onCloseEnd();
    };
    t.prototype.initOriginPos = function () {
        null == this._originPos && (this._originPos = cc.v2(this.node.x, this.node.y));
    };
    Object.defineProperty(t.prototype, "originPos", {
        get: function () {
            null == this._originPos && this.initOriginPos();
            return this._originPos;
        },
        enumerable: !1,
        configurable: !0
    });
    t.prototype.adaptScreen = function () {
        var e = cc.view.getVisibleSize();
        this.node.width = e.width;
        this.node.height = e.height;
    };
    t.prototype.onShowStart = function () {};
    t.prototype.onCloseStart = function () {};
    t.prototype.onShowEnd = function () {};
    t.prototype.onCloseEnd = function () {};
    t.prototype._onTouchEndFilter = function () {
        return !this.isViewInteraction;
    };
    t.prototype._onCloseTouchEnd = function () {
        this.closeUI();
        return "close";
    };
    t.configInfo = {uiMode: u.EmUIMode.PopupMsgUI, zIndex: u.UIDefZIndex.Normal};
    r([d], t.prototype, "createUIBaseComp", null);
    r([d], t.prototype, "createTouchSwallow", null);
    r([d({})], t.prototype, "rightawayShow", void 0);
    r([d({})], t.prototype, "rightawayClose", void 0);
    r([d({})], t.prototype, "openAudio", void 0);
    r([d({displayName: "自动设置visibleSize"})], t.prototype, "autoWeigthSize", void 0);
    return r([p], t);
})(Thor);
o.default = l;
l.default = l;
t.exports = l;
